import { request } from '@/utils/request';

// 查询参数列表
export function listConfig(query: any) {
  return request.get({
    url: '/system/config/list',
    params: query,
  });
}

// 查询参数详细
export function getConfig(configId: string | number) {
  return request.get({
    url: '/system/config/' + configId,
  });
}

// 根据参数键名查询参数值
export function getConfigKey(configKey: string) {
  return request.get({
    url: '/system/config/configKey/' + configKey,
  });
}

// 新增参数配置
export function addConfig(data: any) {
  return request.post({
    url: '/system/config',
    data: data,
  });
}

// 修改参数配置
export function updateConfig(data: any) {
  return request.put({
    url: '/system/config',
    data: data,
  });
}

// 删除参数配置
export function delConfig(configId: string | number) {
  return request.delete({
    url: '/system/config/' + configId,
  });
}

// 刷新参数缓存
export function refreshCache() {
  return request.delete({
    url: '/system/config/refreshCache',
  });
}
